/** layuiAdmin.pro-v1.2.1 LPPL License By http://www.layui.com/admin/ */
;
layui.define(["table", "form"],
    function (e) {
        var $ = layui.$,
            i = (layui.$, layui.admin),
            t = layui.view,
            l = layui.table,
            r = layui.form;
        var sale_id = 0;
        if (layui.params && layui.params.id) {
            sale_id = layui.params.id;
            layui.sale_id = sale_id;
            layui.params = {};
            $('#addverifyerqrcode').data('qrcodeurl', layui.setter.baseUrl + "sale/verifyerqr?id=" + sale_id)
        }
        l.render({
            elem: "#LAY-material-manage",
            url: layui.setter.baseUrl + "material/index?id=" + sale_id,
            cols: [[
                {
                field: "id",
                title: "ID",
                },
                {
                    field: "title",
                    title: "标题"
                },
                {
                    field: "path",
                    title: "链接",
                    templet: "#pathVideo"
                },
                {
                    field: "sale_id",
                    title: "活动ID"
                },
                {
                    field: "type",
                    title: "素材类型",
                    templet: "#type"
                },
                {
                    field: "create_video_id",
                    title: "生成视频编号"
                },
                {
                    field: "is_upload_yun",
                    title: "上传",
                    templet: "#is_upload_yun"
                },
                {
                    field: "createtime",
                    title: "创建时间"
                },
                {
                    title: "操作",
                    align: "center",
                    fixed: "right",
                    style: "overflow: auto",
                    toolbar: "#table-material-oper"
                }]],
            page: !0,
            limit: 10,
            text: {
                none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
            }
        }),
            l.on("tool(LAY-material-manage)",
                function (e) {
                    var l = e.data;
                    if ("del" === e.event) {
                        layer.confirm("确定删除吗？", function (i) {
                            $.post(
                                layui.setter.baseUrl + 'material/del',
                                {id: l.id},
                                function (ret) {
                                    var {code, msg, data} = ret;
                                    layer.alert(msg);
                                    if (code == 0) {
                                        layui.table.reload('LAY-material-manage');
                                    }
                                }
                            );
                        })
                    }
                }),
            e("material", {})
    });